<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function run1() {
            var of = document.getElementsByClassName("itemSelect");
            for (var i = 0; i < of.length; i++) {
                of[i].checked=true;
            }
        }
        function run2() {
            var of = document.getElementsByClassName("itemSelect");
            for (var i = 0; i < of.length; i++) {
                of[i].checked=false;
            }
        }
        function run3() {
            var of = document.getElementsByClassName("itemSelect");
            for (let i = 0; i < of.length; i++) {
                if (of[i].checked==false){
                    of[i].checked=true;
                }else if (of[i].checked==true){
                    of[i].checked=false;
                }
            }
        }
        function run4() {
            var of = document.getElementsByClassName("itemSelect");
            for (let i = 0; i < of.length; i++) {

                if (of[i].checked==true ) {
                    var td = of[i].parentNode;
                    var tr = td.parentNode;
                    tr.remove();
                }
            }
        }
    </script>
</head>
<body>
<table id="f1" border="1" cellpadding="0" cellspacing="0" width="80%">
    <tr>
        <th>
            <input type="button" value="全选" onclick="run1()"/>
            <input type="button" value="全不选" onclick="run2()"/>
            <input type="button" value="反选" onclick="run3()"/>
            <input type="button" value="删除" onclick="run4()"/>
        </th>
        <th>序号</th>
        <th>商品名称</th>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>1</td>
        <td>手机数码</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>2</td>
        <td>电脑办公</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>3</td>
        <td>鞋靴箱包</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>4</td>
        <td>家居饰品</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>5</td>
        <td>童装玩具</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>6</td>
        <td>面料采集</td>
    </tr>
    <tr>
        <td>
            <input type="checkbox" class="itemSelect" />
        </td>
        <td>7</td>
        <td>本地服务</td>
    </tr>
</table>
</body>
</html>